?");
} else if (val.indexOf("i have problem with") > -1) {
if (val.indexOf("girlfriend") > -1 || val.indexOf("gf") > -1) {
appendMsg("take out your girlfriend, for dinner or movie.");
appendMsg("is it helpful? (yes/no)");
} else if (val.indexOf("boyfriend") > -1 || val.indexOf("bf") > -1) {
appendMsg("bye something for him.");
appendMsg("is it helpful? (yes/no)");
} else {
appendMsg("sorry, i'm not able to get you point, please ask something else.");
}
} else if (val.indexOf("yes") > -1) {
var nowtime = new Date();
var nowhoue = nowtime.getHours();
appendMsg("it's my pleaser that i can help you");
saybye();
} else if (val.indexOf("no") > -1) {
var nowtime = new Date();
var nowhoue = nowtime.getHours();
appendMsg("it's my bad that i can't able to help you. please try letter");
saybye();
} else if (val.indexOf("my name is ") > -1 || val.indexOf("i am ") > -1 || val.indexOf("i'm ") > -1 || val.split(" ").length < 2) {/*|| mainval != ""*/
// var name = "";
if (val.indexOf("my name is") > -1) {
name = val.replace("my name is", "");
} else
if (val.indexOf("i am") > -1) {
name = val.replace("i am", "");
} else
if (val.indexOf("i'm") > -1) {
name = val.replace("i'm", "");
} else
{
name = mainval;
}
// appendMsg("hi " + name + ", how can i help you?");
appendMsg("hi " + name + ", how can i help you?");
} else {
appendMsg("sorry i'm not able to understand what do you want to say");
}
function saybye() {
if (nowhoue <= 10) {
appendMsg(" have nice day! :)");
} else if (nowhoue >= 11 || nowhoue <= 20) {
appendMsg(" bye!");
} else {
appendMsg(" good night!");
}
}
var lastMsg = $('.messages_list').find('.msg.message').last().offset().top;
$('.messages').animate({ scrollTop: lastMsg }, 'slow');
});
/* Chatboat Code */
});